#include	<algorithm>
#include	"utf16.h"
#include	<stdint.h>
#include	<iostream>
#include	<fstream>
#include	<vector>
using	namespace	std;
int	main(int	ac,	char	**av){
	if(ac!=3){	cerr<<"format input output\n";	return	0;	}
	string	line;	vector<uint16_t>	u;
	ifstream	fi(av[1]);
	FILE	*f=fopen(av[2],"wb");
	while(getline(fi,line)){
		line.push_back('\n');	u.resize(line.size());
		size_t	n=utf8_to_utf16((uint8_t*)line.data(),line.size(),u.data(),u.size());
		fwrite(u.data(),n*2,1,f);
	}
	fclose(f);
	fi.close();
	return	0;
}